$(function(){
    $.ajax({
        url:'http://localhost:3000/useing/public',
        method:'GET',
        success:function(res){
            var arr = [];
            for( var i = 0; i < 8; i++){
                arr.push(res[i])
            }
            var str = '';
            $.each(arr,function(index,item){
                str += "<li class=li><img class=img src="+item.img+"><h4 class=hh>"+item.text+"</h4>"+
                "<span class=span>"+item.totalnum+"</span>"+
                "<span class=span>"+item.num+"台</span>"+
                "<i class=i>"+item.apply+"<b class=b>申请</b></i>"+
                "<i class=i>剩余时间2天</i>"
                "</li>"
            })
            $('.inbox').html(str)
        }
    })
    $.ajax({
        url:'http://localhost:3000/report/new',
        method:'GET',
        success:function(res1){
            var arr1 = [];
            for(var i = 5; i < 13;i++){
                arr1.push(res1[i])
            }
            var str1 = '';
            $.each(arr1,function(index,item){
                str1 += "<li><img class=img src="+item.img+"><p class=p>"+item.text+"</p>"+
                    "<div class=left>•"+item.uName+"</div>"+
                    "<div class=right>"+
                        "<img src=./css/img/zan.png>3"+
                        "<img src=./css/img/reply.png>3 "+
                    "</div>"+
                "</li>"
            })
            $('.report-con').html(str1)
        }
    })
    $.ajax({
        url:'http://localhost:3000/guid/new',
        method:'GET',
        success:function(res2){
            var arr2 = [];
            for(var i = 0; i < 4;i++){
                arr2.push(res2[i])
            }
            var str2 = '';
            $.each(arr2,function(index,item){

                str2 += "<li>"+
                "<div class=con>"+
                    "<img class=img src="+item.img+">"+
                    "<p class=p>"+item.text+"</p>"+
                    "<div class=right>"+
                        "<img src=./css/img/xin.png>"+item.like+""+
                        "<img src=./css/img/reply.png>"+item.words+""+
                    "</div>"+
                "</div>"+
                "<div class=listbg><img src=./css/img/listbg.jpg></div>"+
            "</li>"
            })
            $('.shoppingguide-con').html(str2)
        }
    })
    $.ajax({
        url:'http://localhost:3000/play/new',
        method:'GET',
        success:function(res3){
            var str3 = '';
            $.each(res3,function(index,item){                   
                $.each(item,function(i,item1){
                    str3 += "<li>"+
                    "<img class=img src="+item1.img+">"+
                    "<p class=p>"+item1.text+"</p>"+
                    "<span class=span>"+item1.description+"</span>"+
                    "<div class=left>"+item1.price+"</div>"+
                    "<div class=right>"+
                    "<img src=./css/img/xin.png>"+item1.like+""+
                    "<img src=./css/img/reply.png>"+item1.words+""+
                    "</div>"+
                    "</div>"+
                    "</li>"
                })           
            })
            $('.discover-con').html(str3)
        } 
    })
    $('.more').click(function(){
        $('.discover').css('height','2082px')
        $(this).html('没有更多啦~').css('color','gray')
    })
})